package exercise.day04;

import java.util.Scanner;

public class WhileDemo {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int mun = (int) (Math.random() * 1000 + 1);
        System.out.println("猜大小：");
        int guess= scan.nextInt();
        while (guess!=mun){
            if(guess>mun){
                System.out.println("猜大了");
            }else{
                System.out.println("猜小了");
            }
                 System.out.println("再猜：");
             guess= scan.nextInt();
        }
        System.out.println("恭喜你猜对了");
        System.out.println("-------while(2)-----------");
        System.out.println("猜大小：");
        int guess1 = scan.nextInt();
        int mun1 = (int) (Math.random() * 100 + 1);
        while (guess1 != mun1) {
            if (guess1>mun1) {
                System.out.println("海绵宝宝说：猜大了，再猜：");
            } else {
                System.out.println("猪猪侠说：猜小了，再猜：");
            }
            guess1= scan.nextInt();
        }
        System.out.println("蒙奇-D-罗杰说：恭喜你猜对了");
    }
}
